package com.wty.cmims.controller;

import com.wty.cmims.pojo.Evaluate;
import com.wty.cmims.pojo.ResponseResult;
import com.wty.cmims.service.EvaluateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/evaluate")
@Tag(name = "评分评价", description = "社区医疗信息管理系统api接口")
public class EvaluateController {
    @Autowired
    private EvaluateService evaluateService;

    @PostMapping("/addEvaluate")
    @Operation(summary = "添加评价", description = "添加评价")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String,Object>> evaluateAdd(@RequestBody Map<String,Object> paramsMap){
        return evaluateService.evaluateAdd(paramsMap);
    }

    @PostMapping("/findEvaluate")
    @Operation(summary = "查询评价", description = "查询评价")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Evaluate> evaluateFind(@RequestBody Map<String,Object> paramsMap){
        return evaluateService.evaluateFind(paramsMap);
    }

    @PutMapping("/deleteEvaluate")
    @Operation(summary = "删除评价", description = "删除评价")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String,Object>> evaluateDelete(@RequestBody Map<String,Object> paramsMap){
        return evaluateService.evaluateDelete(paramsMap);
    }

    @PostMapping("/findEvaluations")
    @Operation(summary = "查询患者评价", description = "查询患者评价")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String, Object>> evaluationsFind(@RequestBody Map<String,Object> paramsMap){
        return evaluateService.evaluationsFind(paramsMap);
    }

    @PostMapping("/computeEvaluation")
    @Operation(summary = "计算医生评分", description = "计算医生评分")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String, Object>> evaluationCompute(@RequestBody Map<String,Object> paramsMap){
        return evaluateService.evaluationCompute(paramsMap);
    }
}